package com.huang.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.huang.mapper.UserInfoMapper;
import com.huang.pojo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserInfoServiceImpl implements UserInfoService{
     @Autowired
    private UserInfoMapper mapper;

    @Override
    public List<UserInfo> getAll() {


        return mapper.selectList(null);
    }

    @Override
    public void insertUser(UserInfo user) {
          mapper.insert(user);
    }

    @Override
    public void deleteById(Integer id) {
        mapper.deleteById(id);
    }

    @Override
    public void updateById(UserInfo userInfo) {
        //使用updatebyid方法，会自动将id作为条件。将其他不为空的作为set
        mapper.updateById(userInfo);
    }
}
